package com.todo.content.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2024/4/23 10:10
 * @description
 */
@Getter
@AllArgsConstructor
public enum ContentRelationTypeEnum {

    PRODUCT(1, "PRODUCT", "商品"),
    STRATEGY(2, "STRATEGY", "攻略"),
    SIGHT(3, "SIGHT", "景点"),
    PLAN_LIST(4, "PLAN_LIST", "清单计划"),
    ADVERT(5, "ADVERT", "广告"),
    OUTSIDE(6, "OUTSIDE", "外部数据"),
    RED_BOOK(7, "RED_BOOK", "小红书"),
    TIC_TOK(8, "TIC_TOK", "抖音"),

    ;

    private static Map<Integer, ContentRelationTypeEnum> typeMap = Arrays
            .stream(ContentRelationTypeEnum.values())
            .collect(Collectors.toMap(ContentRelationTypeEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static ContentRelationTypeEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
